<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<title>国省自检--${fns:getConfig('productName')}</title>
<link rel="stylesheet" href="${ctx}/styles/gsjcss/common.css">
<script type="text/javascript">
function btnClick(){
	var url = '${ctx}/changeInvest/search.do?projectId=${fns:encodeParamUrl(projectId)}&menuId=${fns:encodeParamUrl(menuId)}';
	var data = {};
	if($('#btnSearch').length>0){ //有搜索按钮的情况下 获取条件进行搜索
		//将条件提取出来 
		//将条件存入data中
		//ajax请求   得到数据
		data['retrieval'] = getJson('condition');
		loadData(url,data);
	} else {
		loadData(url,data);
	}
}
//ajax执行成功之后的回调方法
function loadDataToTable(data){
	var attment = data['att'];
	var changeInves = data['changeInves'];
	if($('#dxxm_tzjh').length>0){
		$('#dxxm_tzjh tbody').empty();
		for (var j = 0; j < changeInves.length; j++) {
			var tr ="<tr><td>"+changeInves[j].year+"</td><td>"+changeInves[j].planInvest+"</td><td>"+changeInves[j].completeInvest+"</td>"+
					"<td>"+changeInves[j].investPate+"%</td><td>"+changeInves[j].slowNum+"</td><td>";
			if(changeInves[j].bulletinNumber > 0){
				tr += imgRight;
			} else {
				tr += imgError;
			}
			tr +="</td><td>"+changeInves[j].remark+"</td></tr>";
			$('#dxxm_tzjh tbody').append(tr);
		}
	}
	loadAttachment(attment);
	
	if(data['years'] != undefined){
		//每次搜索前清空表格
		$('#checkResult').empty();
		var years = data['years'];
		var result = "";
		
		var content = '<table style="width:98%;text-align:center;margin-top:5px;" border="1"><thead><tr>'+
		  			  '<th>序号</th><th>年份</th><th>年度计划投资</th><th>年度完成投资</th><th>完成投资占计划投资的百分比P</th><th>被通报进展缓慢项目个数N</th><th>得分</th>'+
		  			  '<th>总得分</th><th>完善度</th></tr>'+
		  			  '</thead><tbody></tbody></table>';			  
		$('#checkResult').append(content);

		for(var j = 0; j< changeInves.length; j++){
			if(j == 0){
				result += '<tr><td>'+parseInt(j+1)+'</td><td>'+changeInves[j].year+'</td>'+
						  '<td>'+changeInves[j].planInvest+'</td><td>'+changeInves[j].completeInvest+'</td>'+
						  '<td>'+changeInves[j].investPate+'%</td><td>'+changeInves[j].slowNum+'</td><td>'+changeInves[j].yearMark+'</td>'+
						  '<td rowspan="'+years.length+'" class="sumTd">'+data['sum']+'</td>'+
						  '<td rowspan="'+years.length+'" class="perTd">'+data['percent']+'%</td></tr>';
			}else {
				result += '<tr><td>'+parseInt(j+1)+'</td><td>'+changeInves[j].year+'</td>'+
						  '<td>'+changeInves[j].planInvest+'</td><td>'+changeInves[j].completeInvest+'</td>'+
				  		  '<td>'+changeInves[j].investPate+'%</td><td>'+changeInves[j].slowNum+'</td><td>'+changeInves[j].yearMark+'</td></tr>';
			}
		}
		$('#checkResult tbody').append(result);
	}
}

</script>
</head>
<body>
	<div id="x_top"></div>
	<tags:message content="${msg}" />
	<c:if test="${not empty checkTable.id}">
		<div style="text-align:center">
			<a href="javascript:void(0);" class="btn btn-primary" onclick="downWord('${ctx}/changeInvest/downWord.do?projectId=${fns:encodeParamUrl(projectId)}&menuId=${fns:encodeParamUrl(menuId)}');" id= "btnDown" role="button" ><div id="x_v"></div></a>
		</div>
	</c:if>
	<form id="checkForm" class="form-horizontal"  method="POST"  name="checkForm" action="${ctx}/changeInvest/save.do?left=${fns:encodeParam(left)}&parentId=${fns:encodeParam(parentId)}&projectId=${fns:encodeParam(projectId)}&menuId=${fns:encodeParam(menuId)}&leftChild=${fns:encodeParam(leftChild)}">
		<input type="hidden" name="token" value="${token}">
		<div id="show">
			<div id="showTable" class="showTable">
				<jsp:include page="/WEB-INF/views/check/common.jsp"/> 
				<div class="model">
					<div>
						<legend>三、检查条件及设置</legend>
						<div class="content-title" id="condition">
							<div style="float:left;margin-top:5px;">
								<span>通报一个项目扣分<font style="color:red;">*</font>：</span>
								<input type='text' name = "yearFull" id="yearFull" value="0.5" class="required conInput"/>
								<span>每年度满分<font style="color:red;">*</font>：</span>
								<input type='text' name = "yearPart" id="yearPart" value="6" class="required conInput"/>
							</div>
							<div id="x_s" style="float:right">
								<div class="x_ico"></div>
								<a href="#javascript:void(0)" onclick= "btnClick();"  id= "btnSearch" role="button" >搜索&nbsp;</a>
							</div>
						</div>
					</div>
				</div>
				<div class="model">
					<div>
						<legend>四、检索结果</legend>
						<div class="content-title">
							<div class="tabbox">
								<div class="tab">
									<c:forEach items="${childMenuList}" var="menu"  varStatus="idxStatus">
										<a href="javascript:;" <c:if test="${idxStatus.index == 0}">class="on"</c:if> >${menu.name}</a>
									</c:forEach>
							    </div>
							    <div class="content">
							    	<ul>
							    		<c:forEach items="${childMenuList}" var="menu"  varStatus="idxStatus">
							    			<li>
							    				<c:choose>
							    					<c:when test="${menu.tag eq 'dxxm_tzjh'}">
							    						<table style="width:99.8%;text-align:center;margin-top:5px;" border="1" id="${menu.tag}">
									    					<thead>
										    					<th>年份</th>
										    					<th>年度计划投资</th>
										    					<th>年度完成投资</th>
										    					<th>投资占比P</th>
										    					<th>被通报进程缓慢项目数N</th>
										    					<th>是否上传项目执行文件</th>
										    					<th>备注</th>
										    				</thead>
								    						<tbody>
									    						
									    					</tbody>
							    						</table>
							    					</c:when>
							    					<c:otherwise>
							    						<table style="width:99.8%;text-align:center;margin-top:5px;" border="1" id="${menu.tag}">
									    					<thead>
									    						<th>序号</th>
										    					<th>操作</th>
										    					<th>发文单位</th>
										    					<th>上传用户</th>
										    					<th>文件名</th>
										    					<th>发文日期</th>
										    					<th>上传日期</th>
										    					<th>文件大小</th>
										    					<th>文件类型</th>
										    				</thead>
								    						<tbody>
									    						
									    					</tbody>
							    						</table>
							    					</c:otherwise>
							    				</c:choose>
							    			</li>
							    		</c:forEach>
							        </ul>
							    </div>
							</div>
						</div>
					</div>
				</div>
				<div class="model">
					<div>
						<legend>五、检查评分</legend>
						<div class="content-title" id="checkResult">
						
						</div>
					</div>
				</div>
				<div class="model">
					<div class="content-btn">
						<input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存" />
						&nbsp;&nbsp;&nbsp;&nbsp;
						<input id="btnCancel" class="btn" type="button" value="返 回" onclick="toBack()" />
					</div>
				</div>
			</div>
		</div>
	</form>
	<script src="${ctxStatic}/js/check/checkCommon.js" type="text/javascript"></script>
</body>
</html>